package item.inkcloud.userservice.service;


import item.inkcloud.userservice.mapper.UserMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class ChangePwdService {

    @Autowired
    UserMapper userMapper;

    public int changePwd(String userid,String oldPassword,String newPassword){

        String resentPassword = userMapper.findPwdByUserID(userid);
        if (resentPassword.equals(oldPassword)){

            userMapper.changePwd(userid,newPassword);

            return 1;
        }else {

            return 0;
        }


    }

}
